package pl.edu.pk.mech.kkbus.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import pl.edu.pk.mech.kkbus.model.New;
import pl.edu.pk.mech.kkbus.repository.NewDAO;

import static pl.edu.pk.mech.kkbus.staticstrings.NameEntity.NAME_ENTITY_NEW;

@Service
public class NewService {

    @Autowired
    NewDAO newDAO;
    
    public List<New> getAllNews() {
        return newDAO.getAllNews();
    }
    
    public boolean addNews(New news) {
        return newDAO.createOrUpdate(news, NAME_ENTITY_NEW, newDAO);
    } 
}
